
begintalkscript;

variables;

begintalknode 10;
	state = -1;
	nextstate = -1;
	question = "Guard";
	text1 = "This guard eyes you with equal amounts of suspicion and optimism. As a result, you don't get any farther than a gruff _Hello._";
	text2 = "One thing's for sure. The siege has the city's garrison on high alert. These soldiers couldn't be farther away from the apathetic narcoleptics you're used to seeing in most cities.";
	code = 
		if(get_flag(6,1) == 1)
			remove_string(2);
		else
		set_flag(6,1,1);
	break;
begintalknode 11;
	state = -1;
	nextstate = -1;
	question = "Archer";
	text1 = "This archer is too busy keeping an eye on the jungle to speak to you. You exchange pleasantries and move on.";
	text2 = "One thing's for sure. The siege has the city's garrison on high alert. These soldiers couldn't be farther away from the apathetic narcoleptics you're used to seeing in most cities.";
	code = 
		if(get_flag(6,1) == 1)
			remove_string(2);
		else
		set_flag(6,1,1);
	break;
begintalknode 20;
	state = -1;
	nextstate = -1;
	question = "Refugee";
	text1 = "This woman is passed out sitting down. A half-finished game of chess sits next to her, and it's not clear who she was playing.";
	text2 = "You decide that there's nothing to be gained from waking her, and move on.";
	text5 = "This woman is still asleep. You refrain from waking her.";
	action = INTRO;

begintalknode 21;
	state = -1;
	nextstate = -1;
	question = "Refugee";
	text1 = "This man is splayed out on the ground, snoring loudly. Occasionally, he thrashes around, further entangling himself with his sleeping pad.";
	text2 = "You decide not to wake him, and move on.";
	text5 = "This man is still sleeping a very unfit sleep. You leave him be.";
	action = INTRO;

begintalknode 22;
	state = -1;
	nextstate = -1;
	question = "Refugee";
	text1 = "This aging man is sleeping peacefully, something which you can hardly believe given the circumstances.";
	text2 = "You let him be, seeing no reason to disturb him.";
	text5 = "The old man is still fast asleep. You refrain from waking him.";
	action = INTRO;

begintalknode 23;
	state = -1;
	nextstate = -1;
	question = "Refugee";
	text1 = "This child is sleeping, quietly enough that for a moment you worry she might be dead.";
	text2 = "However, when you approach her, she quietly whimpers and rolls over. You elect to not wake her.";
	text5 = "The child continues sleeping quietly. Occasionally, you think you can hear a tiny sob.";
	action = INTRO;

begintalknode 30;
	state = -1;
	nextstate = -1;
	question = "Archer";
	text1 = "This archer is sleeping fitfully, probably exhausted from a shift on the walls. He didn't even bother to change out of his armor.";
	text2 = "You leave him be.";
	text5 = "This archer is still asleep, waiting to be called back to duty. You decide not to wake him.";
	action = INTRO;

begintalknode 40;
	state = -1;
	nextstate = 40;
	question = "Commander Fisher";
	text1 = "Like most of the people in Copperpeak, this soldier first reacts to your arrival like the Loyalists have breached the gate. Once he calms down, however, he relaxes his grip on his sword. Not on the bottle of ale, however.";
	text2 = "_Oh. So you're the fools who broke into the city. I thought you'd look crazier than you do. I'm Commander Fisher, and I'm in charge of the city of Copperpeak. What do you want?_";
	text3 = "Fisher's voice cracks every so often, probably from the stress. Or the ale. It doesn't look as though he's had much rest.";
	text5 = "Commander Fisher watches you closely, as if expecting you to switch sides and attack him. He twitches occasionally, running his fingers over the woodwork on his desk.";
	action = INTRO;

begintalknode 41;
	state = 40;
	nextstate = 41;
	question = "So what's the situation here?";
	text1 = "Fisher looks at you as if your head was on fire.";
	text2 = "_Seriously? You're serious. You want to know what's going on?_";
	text3 = "_We're trapped in the city. The Loyalists control the rest of the island, and they aren't leaving. We're running out of food. Every soldier that gets picked off of the walls makes our position that much more tenuous._";
	text4 = "_Why last week they bombed the forge. I don't know how they bombed the forge, but it was just on fire one night. Now it's a ruin, and that's only because we put it out in time._";
	text5 = "_We're dead, that's what's going on. It's just a matter of when._";
	text6 = "_Hasn't changed much. We're still dead._";
	code = 
		if(get_flag(6,7) == 1) {
			clear_strings();
			add_string(6);
		}
		else {
		remove_string(6);
		set_flag(6,7,1);
	}
	break;
begintalknode 42;
	state = 41;
	nextstate = -1;
	condition = get_flag(6,8) == 0;
	question = "Well then why don't you just surrender?";
	text1 = "Commander Fisher laughs, a deep, unsettling laugh. A maniacal laugh.";
	text2 = "_Don't you see? Whatever happens to us while we're trapped in here can't possibly be worse than what the Loyalists will have cooked up for us. We're all scared to death!_";
	text3 = "_The only thing I can imagine worse than capture by Loyalists is if they took the city, then the Empire re-took it. We would be hailed as traitors and cowards._";
	text4 = "_No, the best we can hope for is to die a so-called 'honorable' death at the hands of the Loyalists._";
	code = 
		set_flag(6,8,1);
	break;
begintalknode 43;
	state = 41;
	nextstate = -1;
	condition = get_flag(6,8) == 0;
	question = "How long do you think you can last?";
	text1 = "_Believe me, I've done a lot of thinking on that. I'd give us two more weeks before the people start starving. After that, it'll be no time before the bastards are marching through the gate._";
	text2 = "_And of course, that estimate gets smaller each time someone is picked off the wall by one of the ballistas. We even had a suicide a week ago... someone just threw themselves off the top of the wall._";
	text3 = "_Long story short, we don't have much time. And I'm tired of thinking about it._";
	code = 
		set_flag(6,8,1);
	break;
begintalknode 44;
	state = 40;
	nextstate = -1;
	question = "How are you holding up?";
	text1 = "Fisher blinks, and absentmindedly plays with the lock on his desk.";
	text2 = "_I'm holding out. I have my ways of keeping alert. Also helps that I haven't had a good night's sleep in days._";
	text3 = "He takes a swig from his bottle of ale.";

begintalknode 45;
	state = 40;
	nextstate = 42;
	question = "Tell me about Copperpeak.";
	text1 = "_There's not much to tell, I'm afraid. The city was built just fourteen years ago, and it was supposed to oversee mining operations on the island._";
	text2 = "_Well, the mining never really panned out, so the city lives on as a sort of outpost for people posted to the islands for whatever reason. We get a fair number of mages, too. Naturally, we've only got one right now._";
	text3 = "_Luckily for us, the Empire built the city tough. The walls can take quite a beating, and they have. And the gate's held tough as well. Thankfully, we only have the one gate to defend._";

begintalknode 46;
	state = 42;
	nextstate = -1;
	condition = get_flag(6,10) == 0;
	question = "Is there another way out of Copperpeak?";
	text1 = "Fisher pauses. Then he unlocks and opens his desk, withdrawing a large folded sheet of parchment. He flips it around, and you see that it's a map of the city.";
	text2 = "_Well, there is one other way out. We've got some storage space underground, usually used for experiments. There might still be a tunnel leading out of there to the jungle._";
	text3 = "_Of course, I for one hope that it's sealed off. That's just another route the Loyalists could use to get in here._";
	code = 
		set_flag(6,10,1);
	break;
begintalknode 47;
	state = 42;
	nextstate = -1;
	question = "You said there's a mage here?";
	text1 = "_Yes, his name's Tyler. Quiet. I don't like him. I'd trade him for a decent healer any day of the week._";
	text2 = "He snorts loudly, pounding the table.";
	text3 = "_And you'd think that a mage could be up on the walls, blasting away the Loyalists as they come, right? Well, you'd be wrong. Apparently he studies plants. Plants!_";

begintalknode 48;
	state = 40;
	nextstate = 43;
	question = "What do you want us to do?";
	text1 = "The commander sneers, and you catch a whiff of the alcohol on his breath.";
	text2 = "_Well, if you can find the time, why don't you just go kill the leader of the Loyalists? He's got a ship out there somewhere._";
	text3 = "_Oh, and if you're still free after that, kill all of the Loyalists on the island. Go nuts._";
	text5 = "_What, you need a refresher? Fine, go kill Trevahn._";
	code = 
		if(get_flag(6,11) == 1) {
			clear_strings();
			add_string(5);
		}
		else
		remove_string(5);
	break;
begintalknode 49;
	state = 43;
	nextstate = -1;
	condition = get_flag(6,11) == 0;
	question = "No, seriously. We're adventurers.";
	text1 = "He seems to get a grip on himself. Which isn't saying much, but it's an improvement.";
	text2 = "_Okay. That part I said about their leader? I wasn't really kidding. That might be just the reprieve we've been looking for. I've seen him out in front of the gates a few times. His name is Trevahn._";
	text3 = "_The rest of the Loyalists seem to revere him like a god, next to their precious Dorikas. If you could kill him, the Loyalists would lose their rallying point._";
	text4 = "_It's true, the Loyalists have been very organized, but I've seen outfits like that before. Typically, it's one man keeping it all from spiraling into chaos, and I think that man is Trevahn._";
	code = 
		set_flag(6,11,1);
		toggle_quest(2,1);
	break;
begintalknode 50;
	state = 43;
	nextstate = -1;
	condition = get_flag(6,11) == 1;
	question = "Tell us about Trevahn.";
	text1 = "Fisher shudders, nearly tipping over his ale.";
	text2 = "_He's fearsome. Back when we were fighting the Loyalists on the ground, before we realized how badly off we were, he was the Loyalists' champion._";
	text3 = "_He fights without weapons. And the scary thing is, you wouldn't know it from how deadly he is. He could take on five soldiers at once, and he did._";
	text4 = "_Then the Loyalists brought in another wave of ships, and we fell back to the city. I've seen him pacing outside the gates a few times, just out of range. But he's been gone for a few days, so I think he's back on one of the ships._";
	text5 = "_If you're going to try and kill him, I suggest doing it from a distance._";

begintalknode 51;
	state = 43;
	nextstate = -1;
	condition = get_flag(6,11) == 1;
	question = "How do we reach Trevahn?";
	text1 = "_Well, if you want an easy way, you could go out and let yourselves be captured. He'd probably be the one to interrogate you. Of course, that'd probably get you killed._";
	text2 = "_If you're going to be looking for him, you can't go back out the front. Your best shot is probably to go underground._";
	text3 = "_You remember that tunnel I told you about? Go find the mage and talk to him about it. I don't know what's down there right now._";
	text4 = "_You see, we've got some storage space underground, usually used for experiments. There might still be a tunnel leading out of there to the jungle. Go find the mage that's skulking around and talk to him about it._";
	text5 = "_See, I have no idea if anything's still down there. Could be demons, could be dirt, I don't know._";
	code = 
		if(get_flag(6,10) >= 1) {
			remove_string(4);
			remove_string(5);
		}
		else {
		remove_string(3);
		set_flag(6,10,1);
	}
	break;
begintalknode 60;
	state = -1;
	nextstate = 60;
	question = "Carli";
	text1 = "The first thing you notice about this woman is that she seems out of place. She seems comfortable enough with the goings-on of the kitchen around her, but for some reason it doesn't seem to suit her.";
	text2 = "Then you spot the sling and bullet pouch attached to her belt, and the scars on her arms, and it seems to make sense. She greets you with an anxious smile.";
	text3 = "_Ah, you're the newcomers. My name's Carli, and until recently, I was an adventurer like you. Now I'm stuck out here watching over the supplies._";
	text5 = "Carli continues anxiously pacing the room, occasionally looking over at the oven.";
	action = INTRO;

begintalknode 61;
	state = 60;
	nextstate = 61;
	question = "You used to be an adventurer?";
	text1 = "Carli sighs and frowns.";
	text2 = "_Yes, and if I had my way, I still would be. But the commander's got a point when he says that it'd be suicide to leave the city. But I guess I should explain._";
	text3 = "_I had a small party of my own, just a little while ago. It's a good gig to have out here, what with all the unexplored islands. People will pay a lot for an escort._";
	text4 = "_There were four of us. Phil was the fighter, I'd provide cover fire and light healing, and Alice was an apprentice mage until she blew up a professor. Then there was Matthew... and well, Matthew was an outright bastard._";
	text5 = "_Look, I really don't want to talk about it anymore. The memory is too fresh._";
	code = 
		if(get_flag(6,13) == 0)
			set_flag(6,13,1);
		if(get_flag(6,12) == 1) {
			remove_string(2);
			remove_string(3);
			remove_string(4);
		}
		else {
		remove_string(5);
		
	}
	break;
begintalknode 62;
	state = 61;
	nextstate = -1;
	condition = get_flag(6,12) == 0;
	question = "What happened to the rest of the party?";
	text1 = "Her expression gets cold and distant very quickly.";
	text2 = "_Matthew turned traitor on us. He said there was some wizard out here willing to pay a thousand gold to deliver a package to the mainland. And he was lying._";
	text3 = "_As soon as we landed on this island, he disappeared into the jungle. Not a minute later, and a pack of Loyalists charged out at us, aiming to kill. Matthew was with them._";
	text4 = "Her voice falters a bit, but she continues.";
	text5 = "_Phil and Alice got cut down before they knew what was going on. I just barely got out of there alive, and I raced up here before the Loyalists really pressed the siege._";
	code = 
		set_flag(6,12,1);
	break;
begintalknode 63;
	state = 60;
	nextstate = -1;
	question = "What are you doing here now?";
	text1 = "_I'm keeping an eye on the food. The soldiers make sure everyone gets their fair share, but someone still has to watch the food itself. That's me._";
	text2 = "_And I'll tell you this, we don't have much left. Don't even try stealing anything, or I'll cut you up myself._";

begintalknode 64;
	state = 60;
	nextstate = 62;
	question = "Why don't you come with us?";
	text1 = "Carli thinks about the offer, idly running a finger along one of her scars.";
	text2 = "_Well, I suppose Phil and Alice would've wanted me to keep it up. And if I happen across Matthew, that'll just make it sweeter. In fact, yes. I would love to join you. As long as we kill Matthew if we find him._";
	code = 
		if((get_flag(6,13) == 0) || (get_flag(6,12) == 0)) {
			message_dialog("Carli thinks about the offer, idly running a finger along one of her scars.","_Look, I hardly know you people, and you don't know me. Maybe not right this minute._");
		}
	break;
begintalknode 65;
	state = 62;
	nextstate = -1;
	condition = get_flag(6,12) == 1;
	question = "Yes, of course.";
	text1 = "She pulls out her sling and twirls it around, ready for action.";
	text2 = "_Excellent. Let's get moving, then. If you decide you're sick of me, just bring me back here and I'll get back to work._";
	text3 = "(Carli has joined the party.)";
	action = END_TALK;
	code = 
		add_char_to_party(22);
	break;
begintalknode 66;
	state = 62;
	nextstate = -1;
	condition = get_flag(6,12) == 1;
	question = "On second thought, no.";
	text1 = "_Alright, suit yourself._";
	text2 = "She returns to her work.";
	action = END_TALK;

begintalknode 70;
	state = -1;
	nextstate = 70;
	question = "Tyler";
	text1 = "This young mage is very focused on the mixture he's made in a mortar. He occasionally glances at the hourglass on the table and taps the mortar.";
	text2 = "Eventually, he notices you.";
	text3 = "_Oh, adventurers. I take it you're the ones who just arrived? My name is Tyler, and I am but a scholar trapped here._";
	text5 = "Tyler prods the mixture in his mortar, and it hisses.";
	action = INTRO;

begintalknode 71;
	state = 70;
	nextstate = 72;
	question = "What are you doing here?";
	text1 = "_Well, I came out here to study the local flora. Of course, with the siege, I can't do much, but I still maintain a few experiments within these walls._";
	text2 = "He prods the mixture again.";
	text3 = "_But I'm sure that adventurers such as yourselves would be bored to death by this, so I will spare you._";

begintalknode 72;
	state = 70;
	nextstate = 71;
	question = "Can you teach us anything?";
	text1 = "He snorts.";
	text2 = "_Naturally. What, after all is the point of learning if you do not share the wealth?_";
	text3 = "_I am well-versed in basic alchemy, as well as a few spells that people of your kind might find use for. What would you like to know?_";

begintalknode 73;
	state = 71;
	nextstate = -1;
	question = "I'd like to learn spells.";
	text1 = "Tyler finishes bragging about his magical abilities.";
	code = 
		begin_shop_mode("Tyler's Spellcraft","Tyler lists the various cantrips he is able to teach. Most of them sound far too complex or specialized for you, but a few seem useful.",4,4,-1);
	break;
begintalknode 74;
	state = 71;
	nextstate = -1;
	question = "I'd like to learn alchemy.";
	text1 = "Tyler finishes detailing his alchemical prowess.";
	code = 
		begin_shop_mode("Tyler's Spellcraft","Tyler lists the alchemical recipes he is able to teach. Only a few seem even remotely useful.",5,4,-1);
	break;
begintalknode 75;
	state = 71;
	nextstate = 70;
	question = "I'd like to talk about something else.";
	text1 = "Tyler shrugs.";
	text2 = "_Yes? Get on with it. I've got things to do._";

begintalknode 76;
	state = 72;
	nextstate = -1;
	condition = get_flag(6,14) == 0;
	question = "No, I'd love to hear about your work.";
	text1 = "_Really? Well, let me get one of my specimens, then._";
	text2 = "He ducks under the table and retrieves a shrunken little plant. It looks like it's half-dead, but it puts a huge smile on Tyler's face.";
	text3 = "_Now you see, this little guy is a unique specimen because of the way it processes local toxins..._";
	text4 = "That's about as far as you're able to follow him. He continues for what feels like an eternity. You smile and nod. You won't be making that mistake again.";
	code = 
		set_flag(6,14,1);
	break;
begintalknode 77;
	state = 70;
	nextstate = -1;
	condition = get_flag(6,10) == 1;
	question = "Commander Fisher told us to ask you about the tunnel out of the city.";
	text1 = "A puzzled look crosses Tyler's face.";
	text2 = "_You mean the experiment tunnels? I don't know about a tunnel leaving the city, but I suppose one could be down there somewhere. It would certainly be good news for those of us who want to leave._";
	text3 = "_If you go to the storehouse in the southwest corner of the city, look under the bags of rocks. There's a trapdoor. I just ask this of you: please don't disturb my experiments. They've been undisturbed for months, and must stay that way._";
	code = 
		set_flag(6,10,2);
	break;
begintalknode 78;
	state = 70;
	nextstate = -1;
	condition = get_flag(6,10) == 2;
	question = "Where was that trapdoor again?";
	text1 = "_Off in the storeroom, under the bags of rocks._";
	text2 = "_And don't disturb my experiments!_";

begintalknode 90;
	state = -1;
	nextstate = -1;
	question = "Townswoman";
	text1 = "You make small talk with this woman, but don't learn anything new.";

begintalknode 91;
	state = -1;
	nextstate = -1;
	question = "Child";
	text1 = "This child is fast asleep. You see nothing to be gained by waking him.";

begintalknode 92;
	state = -1;
	nextstate = -1;
	question = "Guard";
	text1 = "This soldier is fast asleep. He's probably between shifts.";

begintalknode 93;
	state = -1;
	nextstate = -1;
	question = "Townsman";
	text1 = "You make small talk with this man for a while, but learn nothing new.";

begintalknode 94;
	state = -1;
	nextstate = -1;
	question = "Townswoman";
	text1 = "You make small talk with this woman for a while, but you learn nothing new.";

